package nl.utwente.fmt.vertalerbouw.tarrh.checker;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Class to hold all data related to function entries in the checker.
 */
public class CheckerFunctionEntry {
	private final List<CheckerClassEntry> parameterTypes = new ArrayList<CheckerClassEntry>();
	private final CheckerClassEntry returnType;

	/**
	 * Construct a new function entry with the specified return type.
	 * 
	 * @param returnType
	 *            the return type of the function.
	 */
	public CheckerFunctionEntry(CheckerClassEntry returnType) {
		super();
		this.returnType = returnType;
	}

	/**
	 * Add an additional parameter to the function represented by this entry.
	 * 
	 * @param type
	 *            the type of the new parameter.
	 */
	public void addParameter(CheckerClassEntry type) {
		parameterTypes.add(type);
	}

	/**
	 * Get an ordered list containing the types of all parameters of the
	 * function.
	 * 
	 * @return an ordered list containing the types of all parameters.
	 */
	public List<CheckerClassEntry> getParameters() {
		return Collections.unmodifiableList(parameterTypes);
	}

	/**
	 * Get the return type of function represented by this entry.
	 * 
	 * @return the return type.
	 */
	public CheckerClassEntry getReturnType() {
		return returnType;
	}
}
